<?php
namespace app\admin\validate;
use think\facade\Db;
use think\Validate;

class Policy extends Validate
{

    protected $rule=[
        'id'    =>'require',
        'cate_id'    =>'require',
        'add_time'    =>'require',
        'title'    =>'require',
        'author'    =>'require',
        'img_url'    =>'require',
        'content'    =>'require',
    ];
    protected $message = [
        'id.require'    => '关键参数不能为空',
        'cate_id.require'    => '分类ID不能为空',
        'add_time.require'    => '添加时间不能为空',
        'title.require'    => '标题不能为空',
        'author.require'    => '作者不能为空',
        'img_url.require'               =>'图片不能为空',
        'content.require'               =>'内容不能为空',
    ];
    protected $scene = [
        'add' =>['title','cate_id','img_url','content','add_time'],
        'edit'=>['id','title','cate_id','img_url','content','add_time'],
        'del' =>['id'],
    ];

}